/**
 *  路由文件配置
 */
import { createRouter, createWebHistory } from "vue-router"
const layout = () => import('@src/components/layout/index.vue')
import { NOT_FOUND_ROUTE } from './Routes/base'
import { setRouteEmitter } from '@src/utils/route-listener'

import { appRoutes } from './routes'

const routes = [
    { path: '/', component: layout,
      children: [
          { path: '/', component: () => import('@src/components/home/index.vue'), name: 'home', meta: { icon: 'icon-home', title: '首页' }},
      ]
    },
    ...appRoutes,
    NOT_FOUND_ROUTE
]

const router = createRouter({
    history: createWebHistory(),
    routes
})

router.afterEach((to) => {
  setRouteEmitter(to)
})

export default router
